package generic;

public class GenericMain {
    class A {
    }

    class B extends A {
    }

    class C extends B {
    }

    class D extends A {
    }

    public static void main(String[] args) {
        Integer[] integers = {1, 2, 3, 4, 5};
        GenericClass<Integer> integerGenericClass = new GenericClass<>(integers);
        String[] strings = {"a", "b", "ccc", "defg"};
        GenericClass<String> stringGenericClass = new GenericClass<>(strings);
//        GenericClass genericClass = new GenericClass(integers);
        print(integerGenericClass.getData());
        print(stringGenericClass.getData());

//        GenericClass<A> genericClass = new GenericClass<C>();
        GenericClass<? extends A> genericClass = new GenericClass<C>();

    }

    public static <T> void print(T[] ts) {
        for (T t : ts) {
            System.out.print(t + " ");
        }
        System.out.println();
    }
}
